Ext.define('Seq.widget.Chart', {
    extend: 'Ext.panel.Panel',
    xtype: 'widgetchart',

    ui: 'light',
    layout: 'fit',
    header: {
        padding: '4 10',
    },
    cls: 'box-border-panel info-card-chart',
    overCls: 'info-card-chart-over',

    maximize(panel, config) {
        Ext.apply(config.custom, {
            dataZoom: [{
                type: 'slider',
                handleSize: 25,
                start: 0,
                end: 100
            }]
        });
        let win = Ext.widget({
            xtype: 'detailwin',
            viewModel: {
                data: {
                    interval: 'pt6h',
                    period: 'pt1m'
                }
            },
            title: panel.title,
            closable: true,
            minWidth: 1024,
            minHeight: 600,
            items: [{
                xtype: 'chartpanel',
                layout: 'fit',
                items: [config]
            }]
        });
        return win;
    },

    tools: [{
        type: 'maximize',
        tooltip: '放大',
        callback(panel, tool, event) {
            let chart = panel.down('echartsbase');
            if (chart) {
                let win = panel.maximize(panel, chart.config), view = win.items.items[0];
                view.fireEvent('refreshdata', view, null, null, {});
            }
        }
    }]

});